package cn.gson.school.controller.zhaosheng;

import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import cn.gson.school.dao.zhaosheng.FollowupDao;
import cn.gson.school.dao.zhaosheng.InputStudentDao;
import cn.gson.school.entity.zhaosheng.FollowupEntity;
import cn.gson.school.entity.zhaosheng.InputStudentEntity;
import cn.gson.school.mappers.zhaosheng.FollowupMapper;

/**
 * 招生模块
 */
@Controller
@RequestMapping("/zhaosheng")
public class ZhaoShengController {
	@Autowired
	private FollowupMapper followupMapper;
	
	@Autowired
	private InputStudentDao inputStudentDao;
	
	@Autowired
	private FollowupDao followDao;
	
	@RequestMapping("/zs-inputstuinfo")
	public void inputStudentinfo() {

	}

	@RequestMapping("/zs-addstuinfo")
	public void addstudentinfo() {

	}
	
	@RequestMapping("/zs-stuinfo-distribution")
	public void addDistribu() {

	}

	@RequestMapping("/zs-add-qianyue")
	public void addQianyue() {

	}

	@RequestMapping("/zs-transferass")
	public void transferass() {

	}

	@RequestMapping("/zs-transferass-add")
	public void addTransferass() {

	}

	@RequestMapping("/zs-followuprecord")
	public void followuprecord() {

	}
	
	@RequestMapping("/followlistall")
	public void followlistall() {

	}

	@RequestMapping("/zs-qianyue-list")
	public void qianyueList() {

	}

	@RequestMapping("/zs-zhexian2")
	public void zhexian2(Model model) {
			Date date=new Date();
			Calendar c = Calendar.getInstance();
	        c.setTime(date);
	        int year = c.get(Calendar.YEAR);
	        System.out.println("year:"+year);
	        int[] years={year-6,year-5,year-4,year-3,year-2,year-1,year};
	        System.out.println("years:"+years[0]+","+years[1]+","+years[2]+years[3]+","+years[4]+","+years[5]+","+years[6]);
			System.out.println("进来AdmissionsreportController报表controller了");
			//录入学生的数量
			List<InputStudentEntity> input=inputStudentDao.chaXunInputStudent(years[0]);
			List<InputStudentEntity> input1=inputStudentDao.chaXunInputStudent(years[1]);
			List<InputStudentEntity> input2=inputStudentDao.chaXunInputStudent(years[2]);
			List<InputStudentEntity> input3=inputStudentDao.chaXunInputStudent(years[3]);
			List<InputStudentEntity> input4=inputStudentDao.chaXunInputStudent(years[4]);
			List<InputStudentEntity> input5=inputStudentDao.chaXunInputStudent(years[5]);
			List<InputStudentEntity> input6=inputStudentDao.chaXunInputStudent(years[6]);
			//查询年总跟进人数
			List<FollowupEntity> follow=followDao.chaXunAllfollowone(years[0]);
			List<FollowupEntity> follow1=followDao.chaXunAllfollowone(years[1]);
			List<FollowupEntity> follow2=followDao.chaXunAllfollowone(years[2]);
			List<FollowupEntity> follow3=followDao.chaXunAllfollowone(years[3]);
			List<FollowupEntity> follow4=followDao.chaXunAllfollowone(years[4]);
			List<FollowupEntity> follow5=followDao.chaXunAllfollowone(years[5]);
			List<FollowupEntity> follow6=followDao.chaXunAllfollowone(years[6]);
			//查询年总录入的学生
			List<InputStudentEntity> one=inputStudentDao.chaXunAllInputStudentone(years[0]);
			List<InputStudentEntity> one1=inputStudentDao.chaXunAllInputStudentone(years[1]);
			List<InputStudentEntity> one2=inputStudentDao.chaXunAllInputStudentone(years[2]);
			List<InputStudentEntity> one3=inputStudentDao.chaXunAllInputStudentone(years[3]);
			List<InputStudentEntity> one4=inputStudentDao.chaXunAllInputStudentone(years[4]);
			List<InputStudentEntity> one5=inputStudentDao.chaXunAllInputStudentone(years[5]);
			List<InputStudentEntity> one6=inputStudentDao.chaXunAllInputStudentone(years[6]);
			
			System.out.println("录入学生的长度是："+input.size());
			
			model.addAttribute("inputStudentCount",JSONArray.toJSONString(input.size()));
			model.addAttribute("inputStudentCount1",JSONArray.toJSONString(input1.size()));
			model.addAttribute("inputStudentCount2",JSONArray.toJSONString(input2.size()));
			model.addAttribute("inputStudentCount3",JSONArray.toJSONString(input3.size()));
			model.addAttribute("inputStudentCount4",JSONArray.toJSONString(input4.size()));
			model.addAttribute("inputStudentCount5",JSONArray.toJSONString(input5.size()));
			model.addAttribute("inputStudentCount6",JSONArray.toJSONString(input6.size()));
			
			model.addAttribute("follow",JSONArray.toJSONString(follow.size()));
			model.addAttribute("follow1",JSONArray.toJSONString(follow1.size()));
			model.addAttribute("follow2",JSONArray.toJSONString(follow2.size()));
			model.addAttribute("follow3",JSONArray.toJSONString(follow3.size()));
			model.addAttribute("follow4",JSONArray.toJSONString(follow4.size()));
			model.addAttribute("follow5",JSONArray.toJSONString(follow5.size()));
			model.addAttribute("follow6",JSONArray.toJSONString(follow6.size()));
			
			model.addAttribute("signCount",JSONArray.toJSONString(one.size()));
			model.addAttribute("signCount1",JSONArray.toJSONString(one1.size()));
			model.addAttribute("signCount2",JSONArray.toJSONString(one2.size()));
			model.addAttribute("signCount3",JSONArray.toJSONString(one3.size()));
			model.addAttribute("signCount4",JSONArray.toJSONString(one4.size()));
			model.addAttribute("signCount5",JSONArray.toJSONString(one5.size()));
			model.addAttribute("signCount6",JSONArray.toJSONString(one6.size()));
	}
}
